package com.efuture.chapterfour

/* @Description:mutator函数学习
 * @Auther: zhaoshanshan
 * @Date: 2022/03/06/5:56 下午
 */
fun main() {
    val list = mutableListOf("zhaoshanshan","liuyifan","chenhang");
    //mutator += -= 操作
    list+="wangwu"//mutator特性 += -= 其实背后就是运算符重载而已
    list+="zhaoliu"
    list-="zhaoshanshan"
    println(list)
    println("=================")
    //removeIf 操作
//    list.removeIf{true}//如果是true 自动将可变集合list一个一个元素的删除
//    println(list)
//    println("=================")

    list.removeIf {it.contains("h")}//把含有h的元素删除掉
    println(list)


}
    